-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add default IsScalar trait #17053
Conversation
c2e633c
to
492997c
Compare
This could be useful outside Base too. For instance in ODE.jl, we try to do computations component-wise when the state is a Vector-like thing and not if it is scalar-like. Whilst dispatching on |
Wouldn't it be better to have an |
I wrote I wouldn't mind having a an |
Let's raise an error for now, since |
I don't think it makes sense to say that an iterator is a scalar. "Scalar" has proven very difficult to pin down, the standard example being Strings, which are iterable but also often occur as array elements. The best approach is to use something like |
My feeling (see ##16966) is that (In particular, I think In consequence, I don't think |
Closing this, given that the strategy followed in #16986 does not need of this trait. If there is interest in the future for something like it I can reopen it and work on it. |
While struggling with #16986, I figured that an
IsScalar
trait (as opposed toHasLength
by default) would help to handle the different scenarios that broadcast might encounter.